<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="#{localeManagerBean.language}" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" template="/WEB-INF/templates/newMainTemplate.xhtml">
        <ui:define name="header">
            <ui:include src="newHeaderCompanyTemplate.xhtml"></ui:include>
        </ui:define>
        <ui:define name="bar">
            <ui:include src="tabBarTemplate.xhtml"></ui:include>
        </ui:define>
        <ui:define name="content">
            <ui:insert name="bag">
                <ui:include src="companyBagTemplate.xhtml"></ui:include>
            </ui:insert>
            <ui:insert name="companyContent">
                Default Content
            </ui:insert>
        </ui:define>
        <h:form>
            <p:growl id="creditsBoughtGrowl"></p:growl>
            <p:socket onMessage="handleMessageCreditsBought" channel="/creditsBought/#{newOrdersCompanyBean.company.idCompany}"/>  
            <p:remoteCommand async="true" name="creditsBoughtCommand" actionListener="#{newOrdersCompanyBean.onCreditsBought()}" update="creditsBoughtGrowl" ></p:remoteCommand>
            <script type="text/javascript">  
                function handleMessageCreditsBought(creditsBoughtData) {
                    creditsBoughtCommand([{name: 'companyOrder', value: creditsBoughtData}]);
                }  
            </script>  
        </h:form>
    </ui:composition>
</html>
